//
// Created by WDC on 2021/12/19.
//
#include <stdio.h>
#include "search.h"

//根据时间查找，一律以天为最小单位



void search_start(list_head head,date start_date_s){
    list_head pointer = head->next;

    while (pointer != NULL) {
        if(pointer->data.start_date.year == start_date_s.year && pointer->data.start_date.month == start_date_s.month && pointer->data.start_date.day == start_date_s.day){
            wprintf(L"\n------------------------------\n");
            wprintf(L"截至时间:%d,%d,%d\n",pointer->data.due_date.year,pointer->data.due_date.month,pointer->data.due_date.day);
            wprintf(L"事件:%ls\n",pointer->data.todo);
            wprintf(L"-------------------------------\n");
        }
        pointer = pointer->next;
    }
    system("pause");
}

void search_end(list_head head,date due_date_s){
    list_head pointer = head;

    while (pointer != NULL) {
        if(pointer->data.due_date.year == due_date_s.year && pointer->data.due_date.month == due_date_s.month && pointer->data.due_date.day == due_date_s.day){
            wprintf(L"\n------------------------------\n");
            wprintf(L"开始时间:%d,%d,%d\n",pointer->data.start_date.year,pointer->data.start_date.month,pointer->data.start_date.day);
            wprintf(L"事件:%ls\n",pointer->data.todo);
            wprintf(L"-------------------------------\n");
        }
        pointer = pointer->next;
    }
    system("pause");
}


